package com.cqut.familiarity.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;
import java.io.Serializable;

import com.cqut.familiarity.entity.vo.userVO.UserVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author atao
 * @since 2021-06-03
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_user")
@ApiModel(value="User对象", description="")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "唯一ID")
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty(value = "姓名")
    private String name;

    @ApiModelProperty(value = "性别")
    private String gender;

    @ApiModelProperty(value = "身高")
    private Integer height;

    @ApiModelProperty(value = "体重")
    private Integer weight;

    @ApiModelProperty(value = "生日")
    private String birth;

    @ApiModelProperty(value = "居住地")
    private String address;

    @ApiModelProperty(value = "个性签名")
    private String signature;

    @ApiModelProperty(value = "联系电话")
    private String phone;

    @ApiModelProperty(value = "个人邮箱")
    private String email;

    @ApiModelProperty(value = "微信号")
    private String wechat;

    @ApiModelProperty(value = "添加好友消息")
    private Integer information;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date modifyTime;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "最近登录的时间")
    @TableField(value = "last_Login_time",fill = FieldFill.INSERT_UPDATE)
    private Date lastLoginTime;

    @ApiModelProperty(value = "逻辑删除")
    @TableField(fill = FieldFill.INSERT)
    private String isDeleted;

    @ApiModelProperty(value = "是否绑定微信号")
    private String openId;

    public void update(UserVO userVO){
        this.name = userVO.getName();
        this.avatar = userVO.getAvatar();
        this.address = userVO.getAddress();
        this.height = userVO.getHeight();
        this.wechat = userVO.getWechat();
        this.weight = userVO.getWeight();
        this.gender = userVO.getGender();
        this.phone = userVO.getPhone();
        this.email = userVO.getEmail();
        this.birth = userVO.getBirth();
        this.signature = userVO.getSignature();
    }

}
